package com.hihiwjc.app.zzmh.activities;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

import com.hihiwjc.app.zzmh.R;
import com.hihiwjc.app.zzmh.fragments.home.RecommendFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * 主界面Activity
 */
public class MainActivity extends BaseActivity {
    private List<Fragment> mFragments;
    private FragmentManager mFm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initFragments();
    }

    private void initFragments() {
        mFragments = new ArrayList<>();
        mFragments.add(new RecommendFragment());
        mFm = getSupportFragmentManager();
        FragmentTransaction transaction = mFm.beginTransaction();
        for (Fragment fragment : mFragments) {
            transaction.add(R.id.app_main_fragment_container, fragment);
        }
        transaction.commit();
    }
}
